/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author bluepc
 */
@Entity
@Table(name = "Customers")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Customers.findAll", query = "SELECT c FROM Customers c"),
    @NamedQuery(name = "Customers.findByIdCus", query = "SELECT c FROM Customers c WHERE c.idCus = :idCus"),
    @NamedQuery(name = "Customers.findByCusName", query = "SELECT c FROM Customers c WHERE c.cusName = :cusName"),
    @NamedQuery(name = "Customers.findByCusPhone", query = "SELECT c FROM Customers c WHERE c.cusPhone = :cusPhone"),
    @NamedQuery(name = "Customers.findByCusMail", query = "SELECT c FROM Customers c WHERE c.cusMail = :cusMail"),
    @NamedQuery(name = "Customers.findByCusAdd", query = "SELECT c FROM Customers c WHERE c.cusAdd = :cusAdd")})
public class Customers implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
   @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer idCus;
    @Size(max = 250)
    @Column(name = "cus_name")
    private String cusName;
    @Size(max = 50)
    @Column(name = "cus_phone")
    private String cusPhone;
    @Size(max = 50)
    @Column(name = "cus_mail")
    private String cusMail;
    @Size(max = 250)
    @Column(name = "cus_add")
    private String cusAdd;
    @OneToMany(mappedBy = "idCus")
    private List<BookTable> bookTableList;
    @OneToMany(mappedBy = "idCus")
    private List<Orders> ordersList;

    public Customers() {
    }

    public Customers(Integer idCus) {
        this.idCus = idCus;
    }

    public Integer getIdCus() {
        return idCus;
    }

    public void setIdCus(Integer idCus) {
        this.idCus = idCus;
    }

    public String getCusName() {
        return cusName;
    }

    public void setCusName(String cusName) {
        this.cusName = cusName;
    }

    public String getCusPhone() {
        return cusPhone;
    }

    public void setCusPhone(String cusPhone) {
        this.cusPhone = cusPhone;
    }

    public String getCusMail() {
        return cusMail;
    }

    public void setCusMail(String cusMail) {
        this.cusMail = cusMail;
    }

    public String getCusAdd() {
        return cusAdd;
    }

    public void setCusAdd(String cusAdd) {
        this.cusAdd = cusAdd;
    }

    @XmlTransient
    public List<BookTable> getBookTableList() {
        return bookTableList;
    }

    public void setBookTableList(List<BookTable> bookTableList) {
        this.bookTableList = bookTableList;
    }

    @XmlTransient
    public List<Orders> getOrdersList() {
        return ordersList;
    }

    public void setOrdersList(List<Orders> ordersList) {
        this.ordersList = ordersList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCus != null ? idCus.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Customers)) {
            return false;
        }
        Customers other = (Customers) object;
        if ((this.idCus == null && other.idCus != null) || (this.idCus != null && !this.idCus.equals(other.idCus))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Customers[ idCus=" + idCus + " ]";
    }
    
}
